package com.codinbros.session001.model;

import java.util.ArrayList;

import processing.core.PApplet;

import com.codinbros.session001.interfaces.Citizen;

public class World {
	private ArrayList<Citizen> citizens;
	private ArrayList<Citizen> environment;
	// the main class, so the children know where to draw.
	private PApplet g;

	public World(PApplet main) {
		g = main;
		citizens = new ArrayList<>();
	}

	/**
	 * adds a Citzen to the world, providing it with
	 * 
	 * @param citizen
	 */
	public void addCitizen(Citizen citizen) {
		citizen.setPapplet(g);
		citizens.add(citizen);
	}

	public void addEnviromentItem(Citizen citizen) {
		environment.add(citizen);
	}

	public void draw() {
		g.fill(0);
		g.rect(0, 0, g.width, g.height);
		for (Citizen citizen : citizens) {
			citizen.draw();
		}
	}
}
